package com.fuershiye.woman.monitor.service.impl;

import com.fuershiye.woman.monitor.beans.Page;
import com.fuershiye.woman.monitor.beans.ViewUser;
import com.fuershiye.woman.monitor.beans.ViewUserTel;
import com.fuershiye.woman.monitor.dao.admin.UserDao;
import com.fuershiye.woman.monitor.model.User;
import com.fuershiye.woman.monitor.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("adminService")
public class AdminServiceImpl implements AdminService {

    @Autowired
    private UserDao adminDao;

    @Override
    public void save(User admin) {
        adminDao.save(admin);
    }
    @Override
    public User get(Long id) {
        return adminDao.get(id);
    }

    @Override
    public User findByName(String username) {
        return adminDao.findByName(username);
    }
    @Override
    public User getByTel(String tel) {
        return adminDao.getByTel(tel);
    }

    @Override
    public List<ViewUser> listByCondition(String name, int status, Page page) {
        return adminDao.listByCondition(name, status, page);
    }

    @Override
    public List<ViewUserTel> getSameAreaUserByAreaid(Long areaid) {
        return adminDao.getSameAreaUserByAreaid(areaid);
    }

    @Override
    public int countByCondition(String name, int status){
        return adminDao.countByCondition(name, status);
    }

}
